package com.seraph.zys.dao.impl;

import com.seraph.bi.suite.support.domain.pagination.PageBox;
import com.seraph.bi.suite.support.domain.pagination.PageObject;
import com.seraph.zys.dao.ScOrgDAO;
import com.seraph.zys.dao.domain.ScOrg;
import com.seraph.zys.dao.domain.ScOrgExample;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

@Repository
public class ScOrgDAOImpl extends SqlMapClientDaoSupport implements ScOrgDAO {

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    public ScOrgDAOImpl() {
        super();
    }

    public List selectByCurrUserOrg(String orgCode) {
    	Map parms = new HashMap();
    	parms.put("orgCode", orgCode);
        List list = getSqlMapClientTemplate().queryForList("sc_org.abatorgenerated_selectByCurrUserOrg", parms);
        return list;
    }  
    
    public List selectByPrCurrUserOrg(String orgCode) {
    	Map parms = new HashMap();
    	parms.put("orgCode", orgCode);
        List list = getSqlMapClientTemplate().queryForList("sc_org.abatorgenerated_selectByPrCurrUserOrg", parms);
        return list;
    }     
    
    public List selectByPcCurrUserOrg(String orgCode) {
    	Map parms = new HashMap();
    	parms.put("orgCode", orgCode);
        List list = getSqlMapClientTemplate().queryForList("sc_org.abatorgenerated_selectByPcCurrUserOrg", parms);
        return list;
    }    
    
    public List selectByPccCurrUserOrg(String orgCode) {
    	Map parms = new HashMap();
    	parms.put("orgCode", orgCode);
        List list = getSqlMapClientTemplate().queryForList("sc_org.abatorgenerated_selectByPccCurrUserOrg", parms);
        return list;
    }
    
    public ScOrg selectByOrgCode(String orgCode) {
        ScOrg key = new ScOrg();
        key.setOrgCode(orgCode);
        ScOrg record = (ScOrg) getSqlMapClientTemplate().queryForObject("sc_org.abatorgenerated_selectByOrgCode", key);
        return record;
    }    
    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    public Integer insert(ScOrg record) {
    	record.setReportLockFlag(0);
        Object newKey = getSqlMapClientTemplate().insert("sc_org.abatorgenerated_insert", record);
        return (Integer) newKey;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    public int updateByPrimaryKey(ScOrg record) {
        int rows = getSqlMapClientTemplate().update("sc_org.abatorgenerated_updateByPrimaryKey", record);
        return rows;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    public int updateByPrimaryKeySelective(ScOrg record) {
        int rows = getSqlMapClientTemplate().update("sc_org.abatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    public List selectByExample(ScOrgExample example, String orderByClause) {
        Map parms = getExampleParms(example);
        if (orderByClause != null) {
            parms.put("ABATOR_ORDER_BY_CLAUSE", orderByClause);
        }
        List list = getSqlMapClientTemplate().queryForList("sc_org.abatorgenerated_selectByExample", parms);
        return list;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    public List selectByExample(ScOrgExample example) {
        return selectByExample(example, null);
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    public ScOrg selectByPrimaryKey(Integer id) {
        ScOrg key = new ScOrg();
        key.setId(id);
        ScOrg record = (ScOrg) getSqlMapClientTemplate().queryForObject("sc_org.abatorgenerated_selectByPrimaryKey", key);
        return record;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    public int deleteByExample(ScOrgExample example) {
        int rows = getSqlMapClientTemplate().delete("sc_org.abatorgenerated_deleteByExample", getExampleParms(example));
        return rows;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    public int deleteByPrimaryKey(Integer id) {
        ScOrg key = new ScOrg();
        key.setId(id);
        int rows = getSqlMapClientTemplate().delete("sc_org.abatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    private Map getIDExampleParms(ScOrgExample example) {
        Map parms = new HashMap();
        switch (example.getId_Indicator()) {
        case ScOrgExample.EXAMPLE_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ID_NULL", "Y");
            } else {
                parms.put("AND_ID_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_NOT_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ID_NOT_NULL", "Y");
            } else {
                parms.put("AND_ID_NOT_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ID_EQUALS", "Y");
            } else {
                parms.put("AND_ID_EQUALS", "Y");
            }
            parms.put("id", example.getId());
            break;
        case ScOrgExample.EXAMPLE_NOT_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ID_NOT_EQUALS", "Y");
            } else {
                parms.put("AND_ID_NOT_EQUALS", "Y");
            }
            parms.put("id", example.getId());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ID_GT", "Y");
            } else {
                parms.put("AND_ID_GT", "Y");
            }
            parms.put("id", example.getId());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ID_GE", "Y");
            } else {
                parms.put("AND_ID_GE", "Y");
            }
            parms.put("id", example.getId());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ID_LT", "Y");
            } else {
                parms.put("AND_ID_LT", "Y");
            }
            parms.put("id", example.getId());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ID_LE", "Y");
            } else {
                parms.put("AND_ID_LE", "Y");
            }
            parms.put("id", example.getId());
            break;
        }
        return parms;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    private Map getFISCAL_YEARExampleParms(ScOrgExample example) {
        Map parms = new HashMap();
        switch (example.getFiscalYear_Indicator()) {
        case ScOrgExample.EXAMPLE_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_FISCAL_YEAR_NULL", "Y");
            } else {
                parms.put("AND_FISCAL_YEAR_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_NOT_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_FISCAL_YEAR_NOT_NULL", "Y");
            } else {
                parms.put("AND_FISCAL_YEAR_NOT_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_FISCAL_YEAR_EQUALS", "Y");
            } else {
                parms.put("AND_FISCAL_YEAR_EQUALS", "Y");
            }
            parms.put("fiscalYear", example.getFiscalYear());
            break;
        case ScOrgExample.EXAMPLE_NOT_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_FISCAL_YEAR_NOT_EQUALS", "Y");
            } else {
                parms.put("AND_FISCAL_YEAR_NOT_EQUALS", "Y");
            }
            parms.put("fiscalYear", example.getFiscalYear());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_FISCAL_YEAR_GT", "Y");
            } else {
                parms.put("AND_FISCAL_YEAR_GT", "Y");
            }
            parms.put("fiscalYear", example.getFiscalYear());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_FISCAL_YEAR_GE", "Y");
            } else {
                parms.put("AND_FISCAL_YEAR_GE", "Y");
            }
            parms.put("fiscalYear", example.getFiscalYear());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_FISCAL_YEAR_LT", "Y");
            } else {
                parms.put("AND_FISCAL_YEAR_LT", "Y");
            }
            parms.put("fiscalYear", example.getFiscalYear());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_FISCAL_YEAR_LE", "Y");
            } else {
                parms.put("AND_FISCAL_YEAR_LE", "Y");
            }
            parms.put("fiscalYear", example.getFiscalYear());
            break;
        }
        return parms;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    private Map getORG_CODEExampleParms(ScOrgExample example) {
        Map parms = new HashMap();
        switch (example.getOrgCode_Indicator()) {
        case ScOrgExample.EXAMPLE_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_CODE_NULL", "Y");
            } else {
                parms.put("AND_ORG_CODE_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_NOT_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_CODE_NOT_NULL", "Y");
            } else {
                parms.put("AND_ORG_CODE_NOT_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_CODE_EQUALS", "Y");
            } else {
                parms.put("AND_ORG_CODE_EQUALS", "Y");
            }
            parms.put("orgCode", example.getOrgCode());
            break;
        case ScOrgExample.EXAMPLE_NOT_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_CODE_NOT_EQUALS", "Y");
            } else {
                parms.put("AND_ORG_CODE_NOT_EQUALS", "Y");
            }
            parms.put("orgCode", example.getOrgCode());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_CODE_GT", "Y");
            } else {
                parms.put("AND_ORG_CODE_GT", "Y");
            }
            parms.put("orgCode", example.getOrgCode());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_CODE_GE", "Y");
            } else {
                parms.put("AND_ORG_CODE_GE", "Y");
            }
            parms.put("orgCode", example.getOrgCode());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_CODE_LT", "Y");
            } else {
                parms.put("AND_ORG_CODE_LT", "Y");
            }
            parms.put("orgCode", example.getOrgCode());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_CODE_LE", "Y");
            } else {
                parms.put("AND_ORG_CODE_LE", "Y");
            }
            parms.put("orgCode", example.getOrgCode());
            break;
        case ScOrgExample.EXAMPLE_LIKE:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_CODE_LIKE", "Y");
            } else {
                parms.put("AND_ORG_CODE_LIKE", "Y");
            }
            parms.put("orgCode", example.getOrgCode());
            break;
        }
        return parms;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    private Map getORG_NAMEExampleParms(ScOrgExample example) {
        Map parms = new HashMap();
        switch (example.getOrgName_Indicator()) {
        case ScOrgExample.EXAMPLE_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_NAME_NULL", "Y");
            } else {
                parms.put("AND_ORG_NAME_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_NOT_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_NAME_NOT_NULL", "Y");
            } else {
                parms.put("AND_ORG_NAME_NOT_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_NAME_EQUALS", "Y");
            } else {
                parms.put("AND_ORG_NAME_EQUALS", "Y");
            }
            parms.put("orgName", example.getOrgName());
            break;
        case ScOrgExample.EXAMPLE_NOT_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_NAME_NOT_EQUALS", "Y");
            } else {
                parms.put("AND_ORG_NAME_NOT_EQUALS", "Y");
            }
            parms.put("orgName", example.getOrgName());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_NAME_GT", "Y");
            } else {
                parms.put("AND_ORG_NAME_GT", "Y");
            }
            parms.put("orgName", example.getOrgName());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_NAME_GE", "Y");
            } else {
                parms.put("AND_ORG_NAME_GE", "Y");
            }
            parms.put("orgName", example.getOrgName());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_NAME_LT", "Y");
            } else {
                parms.put("AND_ORG_NAME_LT", "Y");
            }
            parms.put("orgName", example.getOrgName());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_NAME_LE", "Y");
            } else {
                parms.put("AND_ORG_NAME_LE", "Y");
            }
            parms.put("orgName", example.getOrgName());
            break;
        case ScOrgExample.EXAMPLE_LIKE:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_NAME_LIKE", "Y");
            } else {
                parms.put("AND_ORG_NAME_LIKE", "Y");
            }
            parms.put("orgName", example.getOrgName());
            break;
        }
        return parms;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    private Map getORG_SHORT_NAMEExampleParms(ScOrgExample example) {
        Map parms = new HashMap();
        switch (example.getOrgShortName_Indicator()) {
        case ScOrgExample.EXAMPLE_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_SHORT_NAME_NULL", "Y");
            } else {
                parms.put("AND_ORG_SHORT_NAME_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_NOT_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_SHORT_NAME_NOT_NULL", "Y");
            } else {
                parms.put("AND_ORG_SHORT_NAME_NOT_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_SHORT_NAME_EQUALS", "Y");
            } else {
                parms.put("AND_ORG_SHORT_NAME_EQUALS", "Y");
            }
            parms.put("orgShortName", example.getOrgShortName());
            break;
        case ScOrgExample.EXAMPLE_NOT_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_SHORT_NAME_NOT_EQUALS", "Y");
            } else {
                parms.put("AND_ORG_SHORT_NAME_NOT_EQUALS", "Y");
            }
            parms.put("orgShortName", example.getOrgShortName());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_SHORT_NAME_GT", "Y");
            } else {
                parms.put("AND_ORG_SHORT_NAME_GT", "Y");
            }
            parms.put("orgShortName", example.getOrgShortName());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_SHORT_NAME_GE", "Y");
            } else {
                parms.put("AND_ORG_SHORT_NAME_GE", "Y");
            }
            parms.put("orgShortName", example.getOrgShortName());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_SHORT_NAME_LT", "Y");
            } else {
                parms.put("AND_ORG_SHORT_NAME_LT", "Y");
            }
            parms.put("orgShortName", example.getOrgShortName());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_SHORT_NAME_LE", "Y");
            } else {
                parms.put("AND_ORG_SHORT_NAME_LE", "Y");
            }
            parms.put("orgShortName", example.getOrgShortName());
            break;
        case ScOrgExample.EXAMPLE_LIKE:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_SHORT_NAME_LIKE", "Y");
            } else {
                parms.put("AND_ORG_SHORT_NAME_LIKE", "Y");
            }
            parms.put("orgShortName", example.getOrgShortName());
            break;
        }
        return parms;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    private Map getORG_LEVELExampleParms(ScOrgExample example) {
        Map parms = new HashMap();
        switch (example.getOrgLevel_Indicator()) {
        case ScOrgExample.EXAMPLE_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_LEVEL_NULL", "Y");
            } else {
                parms.put("AND_ORG_LEVEL_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_NOT_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_LEVEL_NOT_NULL", "Y");
            } else {
                parms.put("AND_ORG_LEVEL_NOT_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_LEVEL_EQUALS", "Y");
            } else {
                parms.put("AND_ORG_LEVEL_EQUALS", "Y");
            }
            parms.put("orgLevel", example.getOrgLevel());
            break;
        case ScOrgExample.EXAMPLE_NOT_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_LEVEL_NOT_EQUALS", "Y");
            } else {
                parms.put("AND_ORG_LEVEL_NOT_EQUALS", "Y");
            }
            parms.put("orgLevel", example.getOrgLevel());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_LEVEL_GT", "Y");
            } else {
                parms.put("AND_ORG_LEVEL_GT", "Y");
            }
            parms.put("orgLevel", example.getOrgLevel());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_LEVEL_GE", "Y");
            } else {
                parms.put("AND_ORG_LEVEL_GE", "Y");
            }
            parms.put("orgLevel", example.getOrgLevel());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_LEVEL_LT", "Y");
            } else {
                parms.put("AND_ORG_LEVEL_LT", "Y");
            }
            parms.put("orgLevel", example.getOrgLevel());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_ORG_LEVEL_LE", "Y");
            } else {
                parms.put("AND_ORG_LEVEL_LE", "Y");
            }
            parms.put("orgLevel", example.getOrgLevel());
            break;
        }
        return parms;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    private Map getREPORT_LOCK_FLAGExampleParms(ScOrgExample example) {
        Map parms = new HashMap();
        switch (example.getReportLockFlag_Indicator()) {
        case ScOrgExample.EXAMPLE_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_REPORT_LOCK_FLAG_NULL", "Y");
            } else {
                parms.put("AND_REPORT_LOCK_FLAG_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_NOT_NULL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_REPORT_LOCK_FLAG_NOT_NULL", "Y");
            } else {
                parms.put("AND_REPORT_LOCK_FLAG_NOT_NULL", "Y");
            }
            break;
        case ScOrgExample.EXAMPLE_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_REPORT_LOCK_FLAG_EQUALS", "Y");
            } else {
                parms.put("AND_REPORT_LOCK_FLAG_EQUALS", "Y");
            }
            parms.put("reportLockFlag", example.getReportLockFlag());
            break;
        case ScOrgExample.EXAMPLE_NOT_EQUALS:
            if (example.isCombineTypeOr()) {
                parms.put("OR_REPORT_LOCK_FLAG_NOT_EQUALS", "Y");
            } else {
                parms.put("AND_REPORT_LOCK_FLAG_NOT_EQUALS", "Y");
            }
            parms.put("reportLockFlag", example.getReportLockFlag());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_REPORT_LOCK_FLAG_GT", "Y");
            } else {
                parms.put("AND_REPORT_LOCK_FLAG_GT", "Y");
            }
            parms.put("reportLockFlag", example.getReportLockFlag());
            break;
        case ScOrgExample.EXAMPLE_GREATER_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_REPORT_LOCK_FLAG_GE", "Y");
            } else {
                parms.put("AND_REPORT_LOCK_FLAG_GE", "Y");
            }
            parms.put("reportLockFlag", example.getReportLockFlag());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN:
            if (example.isCombineTypeOr()) {
                parms.put("OR_REPORT_LOCK_FLAG_LT", "Y");
            } else {
                parms.put("AND_REPORT_LOCK_FLAG_LT", "Y");
            }
            parms.put("reportLockFlag", example.getReportLockFlag());
            break;
        case ScOrgExample.EXAMPLE_LESS_THAN_OR_EQUAL:
            if (example.isCombineTypeOr()) {
                parms.put("OR_REPORT_LOCK_FLAG_LE", "Y");
            } else {
                parms.put("AND_REPORT_LOCK_FLAG_LE", "Y");
            }
            parms.put("reportLockFlag", example.getReportLockFlag());
            break;
        }
        return parms;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    private Map getExampleParms(ScOrgExample example) {
        Map parms = new HashMap();
        parms.putAll(getIDExampleParms(example));
        parms.putAll(getFISCAL_YEARExampleParms(example));
        parms.putAll(getORG_CODEExampleParms(example));
        parms.putAll(getORG_NAMEExampleParms(example));
        parms.putAll(getORG_SHORT_NAMEExampleParms(example));
        parms.putAll(getORG_LEVELExampleParms(example));
        parms.putAll(getREPORT_LOCK_FLAGExampleParms(example));
        return parms;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    public int selectCountByExample(ScOrgExample example) {
        Map parms = getExampleParms(example);
        int count = ((Integer)getSqlMapClientTemplate().queryForObject("sc_org.abatorgenerated_selectCountByExample", parms)).intValue();
        return count;
    }

    public int selectCountByCurrUserOrg(String orgCode) {
    	Map parms = new HashMap();
    	parms.put("orgCode", orgCode);
        int count = ((Integer)getSqlMapClientTemplate().queryForObject("sc_org.abatorgenerated_selectCountByCurrUserOrg", parms)).intValue();
        return count;
    }    
    
    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    public PageBox selectByCurrUserOrgWithPaging(String orgCode, int pageSize, int pageNum, String orderByClause) {
    	Map parms = new HashMap();
    	parms.put("orgCode", orgCode);
        if (orderByClause != null) {
            parms.put("ABATOR_ORDER_BY_CLAUSE", orderByClause);
        }
        PageBox pageBox = new PageBox();
        PageObject pageObject = new PageObject();
        pageObject.setPageSize(pageSize);
        pageObject.setPageIndex(pageNum);
        int itemAmount = selectCountByCurrUserOrg(orgCode);
        pageObject.setItemAmount(itemAmount);
        List pageList = null;
        if (pageObject.getBeginIndex() <= pageObject.getItemAmount()) {
            pageList = (getSqlMapClientTemplate().queryForList("sc_org.abatorgenerated_selectByCurrUserOrg2", parms, pageObject.getBeginIndex() - 1, pageSize));
        }
        pageBox.setPageObject(pageObject);
        pageBox.setPageList(pageList);
        return pageBox;
    }    
    
    
    public PageBox selectByExampleWithPaging(ScOrgExample example, int pageSize, int pageNum, String orderByClause) {
        Map parms = getExampleParms(example);
        if (orderByClause != null) {
            parms.put("ABATOR_ORDER_BY_CLAUSE", orderByClause);
        }
        PageBox pageBox = new PageBox();
        PageObject pageObject = new PageObject();
        pageObject.setPageSize(pageSize);
        pageObject.setPageIndex(pageNum);
        int itemAmount = selectCountByExample(example);
        pageObject.setItemAmount(itemAmount);
        List pageList = null;
        if (pageObject.getBeginIndex() <= pageObject.getItemAmount()) {
            pageList = (getSqlMapClientTemplate().queryForList("sc_org.abatorgenerated_selectByExample", parms, pageObject.getBeginIndex() - 1, pageSize));
        }
        pageBox.setPageObject(pageObject);
        pageBox.setPageList(pageList);
        return pageBox;
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    public PageBox selectByExampleWithPaging(ScOrgExample example, int pageSize, int pageNum) {
        return selectByExampleWithPaging(example, pageSize, pageNum, null);
    }

    /**
     * This method was generated by Abator for iBATIS.
     * This method corresponds to the database table sc_org
     *
     * @abatorgenerated Wed May 09 21:22:52 CST 2012
     */
    public int updateByPrimaryKeyForCgs(ScOrg record) {
        int rows = getSqlMapClientTemplate().update("sc_org.abatorgenerated_updateByPrimaryKeyForCgs", record);
        return rows;
    }
    
    public int lockReport(String fiscalYear,String orgCode) {
    	ScOrg record=new ScOrg();
    	record.setOrgCode(orgCode);
    	record.setFiscalYear(Integer.parseInt(fiscalYear));
        int rows = getSqlMapClientTemplate().update("sc_org.abatorgenerated_lockReport", record);
        return rows;
    } 
    
    public int unLockReport(String fiscalYear,String orgCode) {
    	ScOrg record=new ScOrg();
    	record.setOrgCode(orgCode);
    	record.setFiscalYear(Integer.parseInt(fiscalYear));
        int rows = getSqlMapClientTemplate().update("sc_org.abatorgenerated_unLockReport", record);
        return rows;
    }    
}